home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / keyb / kbscan.zip / KBSCAN.DOC < prev    next >
Text File  |  1988-01-15  |  603b  |  32 lines

  1. /*
  2. *    Keyboard test program
  3. */
  4.  
  5. #include <dos.h>
  6.  
  7. int main(argc, argv)
  8.     int argc;
  9.     char **argv;
  10. {
  11.     union REGS regs;
  12.  
  13.     printf ("Keyboard test (use Esc to exit)\n\n");
  14.     for (;;)
  15.         {
  16.         regs.h.ah = 0;
  17.         int86 (0x16, ®s, ®s);
  18.         if ( regs.h.al )
  19.             {
  20.             printf ("Normal key, scancode: %3d(dec), %2x(hex) ",
  21.                         regs.h.ah, regs.h.ah);
  22.             printf (" Value: %3d(dec), %2x(hex), Ascii:%c\n",
  23.                         regs.h.al, regs.h.al, regs.h.al);
  24.             if ( regs.h.al == 033 )
  25.                 break;
  26.             }
  27.         else
  28.             printf ("Extended key, scancode: %3d(dec), %2x(hex)\n",
  29.                         regs.h.ah, regs.h.ah);
  30.         }
  31. }
  32.